package com.ruoyi.wechat.service.impl;

import com.ruoyi.wechat.domain.AppVip;
import com.ruoyi.wechat.mapper.AppVipMapper;
import com.ruoyi.wechat.service.IAppVipService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

/**
 * 会员卡信息Service业务层处理
 *
 * @author YinHeng
 * @date 2024-05-07
 */
@Service
public class AppVipServiceImpl implements IAppVipService {
    @Autowired
    private AppVipMapper appVipMapper;

    /**
     * 查询会员卡信息
     *
     * @param id 会员卡信息主键
     * @return 会员卡信息
     */
    @Override
    public AppVip selectAppVipById(Long id) {
        return appVipMapper.selectAppVipById(id);
    }

    /**
     * 查询会员卡信息列表
     *
     * @param appVip 会员卡信息
     * @return 会员卡信息
     */
    @Override
    public List<AppVip> selectAppVipList(AppVip appVip) {
        return appVipMapper.selectAppVipList(appVip);
    }

    /**
     * 新增会员卡信息
     *
     * @param appVip 会员卡信息
     * @return 结果
     */
    @Override
    public int insertAppVip(AppVip appVip) {
        appVip.setCreateTime(LocalDateTime.now());
        return appVipMapper.insertAppVip(appVip);
    }

    /**
     * 修改会员卡信息
     *
     * @param appVip 会员卡信息
     * @return 结果
     */
    @Override
    public int updateAppVip(AppVip appVip) {
        appVip.setUpdateTime(LocalDateTime.now());
        return appVipMapper.updateAppVip(appVip);
    }

    /**
     * 批量删除会员卡信息
     *
     * @param ids 需要删除的会员卡信息主键
     * @return 结果
     */
    @Override
    public int deleteAppVipByIds(Long[] ids) {
        return appVipMapper.deleteAppVipByIds(ids);
    }

    /**
     * 删除会员卡信息信息
     *
     * @param id 会员卡信息主键
     * @return 结果
     */
    @Override
    public int deleteAppVipById(Long id) {
        return appVipMapper.deleteAppVipById(id);
    }
}
